package com.example.actionsignin.http;

import com.example.actionsignin.entity.ActionEntity;
import com.example.actionsignin.entity.DescribeEntity;
import com.example.actionsignin.entity.FaceEntity;
import com.example.actionsignin.entity.FaceImageEntity;
import com.example.actionsignin.entity.ImagesEntity;
import com.example.actionsignin.entity.LoginEntity;
import com.example.actionsignin.entity.UserEntity;

import java.util.List;
import java.util.Map;

import io.reactivex.Observable;
import okhttp3.MultipartBody;
import okhttp3.RequestBody;
import okhttp3.ResponseBody;
import retrofit2.http.Field;
import retrofit2.http.FieldMap;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.Part;
import retrofit2.http.PartMap;

/**
 *
 * Created by 旭 on 2017/9/23/023.
 */

public interface ApiService {

    //登录模块
    @FormUrlEncoded
    @POST("/sign/userAction_login.action")
    Observable<LoginEntity> onLogin(@Field("telephone") String telephone,@Field("password") String password);

    //注册模块
    @Multipart
    @POST("/sign/userAction_regist.action")
    Observable<LoginEntity> onEnroll(@Part("name") String name,
                                     @Part("telephone") String telephone,
                                     @Part("school") String school,
                                     @Part("snumber") String snumber,
                                     @Part("password") String password,
                                     @Part MultipartBody.Part image);

    //发布活动
    @Multipart
    @POST("/sign/activityAction_publishActivity.action")
    Observable<LoginEntity> onRelease(@Part("name") String name,
                                      @Part("content") String content,
                                      @Part("period") String period,
                                      @Part("type") String type,
                                      @Part("start") String start,
                                      @Part("end") String end,
                                      @Part("address") String address,
                                      @Part("x") double x,
                                      @Part("y") double y,
                                      @Part MultipartBody.Part photo1,
                                      @Part MultipartBody.Part photo2,
                                      @Part MultipartBody.Part photo3);

    //获取所有活动
    @GET("/sign/activityAction_findAllActivities.action")
    Observable<List<ActionEntity<UserEntity,ImagesEntity>>> getAllAction();

    //获得获得详情
    @FormUrlEncoded
    @POST("/sign/activityAction_getActivityById.action")
    Observable<DescribeEntity<UserEntity,ImagesEntity>> onActionDescribe(@Field("aid") String id);

    //参加活动
    @FormUrlEncoded
    @POST("/sign/activityAction_joinActivity.action")
    Observable<LoginEntity> onActionEnroll(@Field("aid") String id);

    //我发布的
    @GET("/sign/activityAction_getAllPublishActivities.action")
    Observable<List<ActionEntity<UserEntity,ImagesEntity>>> getManageAction();

    //我参加的
    @GET("/sign/activityAction_getAllJoinActivities.action")
    Observable<List<ActionEntity<UserEntity,ImagesEntity>>> getJoinAction();

    //删除活动
    @FormUrlEncoded
    @POST("/sign/activityAction_deleteActivity.action")
    Observable<String> onDeleteAction(@Field("aid") String id);

    //签到
    @FormUrlEncoded
    @POST("/sign/activityAction_sign.action")
    Observable<LoginEntity> onSignAction(@Field("aid") String id);

    //获取用户信息
    @GET("/sign/userAction_getLoginUserMessage.action")
    Observable<UserEntity> onGetUser();

    //获取注册时上传的图片
    @GET("/sign/userAction_getFace")
    Observable<FaceImageEntity> getFaceImage();
}
